<?php
namespace app\index\controller;

use think\Controller;

class Base extends Controller
{

    public function _initialize()
    {
        $appid='wx77bbae81f989556c';
        $appsecret='f7c7a404c7f5ef43ae7ba7816bbb91c6';
        $token = 'FUDAOWX';
		
        if (empty(session('uid')) || empty(session('uname'))) {
            $return_url = "http://".$_SERVER['SERVER_NAME']."/index/wxsdk/getUserOpenId";;
            $redirect_uri = urlencode($return_url);
            $url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=".$appid."&redirect_uri=".$redirect_uri."&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
            header('location:'.$url);
        }
        
    }
}